﻿// RS232SetDlg.cpp: 实现文件
//

#include "pch.h"
#include "ProjectAA.h"
#include "RS232SetDlg.h"
#include "afxdialogex.h"


// CRS232SetDlg 对话框

IMPLEMENT_DYNAMIC(CRS232SetDlg, CDialogEx)

CRS232SetDlg::CRS232SetDlg(CWnd* pParent /*=nullptr*/)
	: CDialogEx(IDD_DIALOG_COM, pParent)
	, m_nLinkFlag(FALSE)
	, m_nPowerCom(0)
	, m_nPowerPort(0)
	, m_fValSet0(0)
	, m_fCurrentSet0(0)
	, m_fValSet1(0)
	, m_fCurrentSet1(0)
	, SetPos_UVATA(0)
	, SetBrightness_UVATA(0)
	, SetColorTemperature_UVATA(0)
	, SetBrightness_RED_UVATA(0)
	, WhiteLightFlag_UVATA(FALSE)
	, RedLightFlag_UVATA(FALSE)
	, SetPos_2_UVATA(0)
	, SetPos_3_UVATA(0)
	, SetPos_4_UVATA(0)
	, SetPos_5_UVATA(0)
	, SetBrightness_2_UVATA(0)
	, SetBrightness_3_UVATA(0)
	, SetBrightness_4_UVATA(0)
	, SetBrightness_5_UVATA(0)
	, SetColorTemperature_2_UVATA(0)
	, SetColorTemperature_3_UVATA(0)
	, SetColorTemperature_4_UVATA(0)
	, SetColorTemperature_5_UVATA(0)
	, SetBrightness_RED_2_UVATA(0)
	, SetBrightness_RED_3_UVATA(0)
	, SetBrightness_RED_4_UVATA(0)
	, SetBrightness_RED_5_UVATA(0)
	, AutoSetLightFlag(FALSE)
{

}

CRS232SetDlg::~CRS232SetDlg()
{
}

void CRS232SetDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialogEx::DoDataExchange(pDX);
	DDX_Check(pDX, IDC_CHECK_POWERLINK, m_nLinkFlag);
	DDX_Text(pDX, IDC_EDIT_COM3, m_nPowerCom);
	DDX_Text(pDX, IDC_EDIT_PORT3, m_nPowerPort);
	DDX_Text(pDX, IDC_EDIT_VAL0, m_fValSet0);
	DDX_Text(pDX, IDC_EDIT_CURRENT0, m_fCurrentSet0);
	DDX_Text(pDX, IDC_EDIT_VAL1, m_fValSet1);
	DDX_Text(pDX, IDC_EDIT_CURRENT1, m_fCurrentSet1);
	DDX_Text(pDX, IDC_EDIT2, SetPos_UVATA);
	DDX_Text(pDX, IDC_EDIT16, SetBrightness_UVATA);
	DDX_Text(pDX, IDC_EDIT7, SetColorTemperature_UVATA);
	DDX_Text(pDX, IDC_EDIT8, SetBrightness_RED_UVATA);
	DDX_Check(pDX, IDC_CHECK4, WhiteLightFlag_UVATA);
	DDX_Check(pDX, IDC_CHECK5, RedLightFlag_UVATA);
	DDX_Control(pDX, IDC_COMBO2, m_comboRedLightMode);
	DDX_Text(pDX, IDC_EDIT9, SetPos_2_UVATA);
	DDX_Text(pDX, IDC_EDIT13, SetPos_3_UVATA);
	DDX_Text(pDX, IDC_EDIT20, SetPos_4_UVATA);
	DDX_Text(pDX, IDC_EDIT23, SetPos_5_UVATA);
	DDX_Text(pDX, IDC_EDIT29, SetBrightness_2_UVATA);
	DDX_Text(pDX, IDC_EDIT30, SetBrightness_3_UVATA);
	DDX_Text(pDX, IDC_EDIT32, SetBrightness_4_UVATA);
	DDX_Text(pDX, IDC_EDIT34, SetBrightness_5_UVATA);
	DDX_Text(pDX, IDC_EDIT11, SetColorTemperature_2_UVATA);
	DDX_Text(pDX, IDC_EDIT31, SetColorTemperature_3_UVATA);
	DDX_Text(pDX, IDC_EDIT33, SetColorTemperature_4_UVATA);
	DDX_Text(pDX, IDC_EDIT35, SetColorTemperature_5_UVATA);
	DDX_Text(pDX, IDC_EDIT12, SetBrightness_RED_2_UVATA);
	DDX_Text(pDX, IDC_EDIT18, SetBrightness_RED_3_UVATA);
	DDX_Text(pDX, IDC_EDIT19, SetBrightness_RED_4_UVATA);
	DDX_Text(pDX, IDC_EDIT24, SetBrightness_RED_5_UVATA);
	DDX_Check(pDX, IDC_CHECK6, AutoSetLightFlag);
}


BEGIN_MESSAGE_MAP(CRS232SetDlg, CDialogEx)
	ON_BN_CLICKED(IDC_BUTTON_SAVE, &CRS232SetDlg::OnBnClickedButtonSave)
	ON_BN_CLICKED(IDC_BUTTON2, &CRS232SetDlg::OnBnClickedButton2)
	ON_BN_CLICKED(IDC_BUTTON4, &CRS232SetDlg::OnBnClickedButton4)
	ON_BN_CLICKED(IDC_BUTTON5, &CRS232SetDlg::OnBnClickedButton5)
	ON_BN_CLICKED(IDC_BUTTON10, &CRS232SetDlg::OnBnClickedButton10)
	ON_BN_CLICKED(IDC_BUTTON3, &CRS232SetDlg::OnBnClickedButton3)
	ON_BN_CLICKED(IDC_BUTTON6, &CRS232SetDlg::OnBnClickedButton6)
	ON_BN_CLICKED(IDC_BUTTON23, &CRS232SetDlg::OnBnClickedButton23)
END_MESSAGE_MAP()


// CRS232SetDlg 消息处理程序


BOOL CRS232SetDlg::OnInitDialog()
{
	CDialogEx::OnInitDialog();

	ReadConfigIni();
	m_comboRedLightMode.ResetContent();
	m_comboRedLightMode.AddString(L"0:850");
	m_comboRedLightMode.AddString(L"1:940");
	m_comboRedLightMode.SetCurSel(gSystemMgr.RedLightMode_UVATA);


	return TRUE;  
}


void CRS232SetDlg::OnCancel()
{
	CDialogEx::OnCancel();
}

void CRS232SetDlg::ReadConfigIni()
{
	m_nLinkFlag = gSystemMgr.m_nPowerFlag;
	m_nPowerCom = gSystemMgr.m_nPowerPort;
	m_nPowerPort = gSystemMgr.m_nPowerBaudrate;
	m_fValSet0 = gSystemMgr.voltage_val[0];
	m_fCurrentSet0 = gSystemMgr.current_limit[0];
	m_fValSet1 = gSystemMgr.voltage_val[1];
	m_fCurrentSet1 = gSystemMgr.current_limit[1];

	WhiteLightFlag_UVATA = gSystemMgr.WhiteLightFlag_UVATA;
	RedLightFlag_UVATA = gSystemMgr.RedLightFlag_UVATA;

	AutoSetLightFlag = gSystemMgr.AutoSetLightFlag;

	SetPos_UVATA = gSystemMgr.SetPos_UVATA[0];
	SetPos_2_UVATA = gSystemMgr.SetPos_UVATA[1];
	SetPos_3_UVATA = gSystemMgr.SetPos_UVATA[2];
	SetPos_4_UVATA = gSystemMgr.SetPos_UVATA[3];
	SetPos_5_UVATA = gSystemMgr.SetPos_UVATA[4];
	SetBrightness_UVATA = gSystemMgr.SetBrightness_UVATA[0];
	SetBrightness_2_UVATA = gSystemMgr.SetBrightness_UVATA[1];
	SetBrightness_3_UVATA = gSystemMgr.SetBrightness_UVATA[2];
	SetBrightness_4_UVATA = gSystemMgr.SetBrightness_UVATA[3];
	SetBrightness_5_UVATA = gSystemMgr.SetBrightness_UVATA[4];
	SetColorTemperature_UVATA = gSystemMgr.SetColorTemperature_UVATA[0];
	SetColorTemperature_2_UVATA = gSystemMgr.SetColorTemperature_UVATA[1];
	SetColorTemperature_3_UVATA = gSystemMgr.SetColorTemperature_UVATA[2];
	SetColorTemperature_4_UVATA = gSystemMgr.SetColorTemperature_UVATA[3];
	SetColorTemperature_5_UVATA = gSystemMgr.SetColorTemperature_UVATA[4];
	SetBrightness_RED_UVATA = gSystemMgr.SetBrightness_RED_UVATA[0];
	SetBrightness_RED_2_UVATA = gSystemMgr.SetBrightness_RED_UVATA[1];
	SetBrightness_RED_3_UVATA = gSystemMgr.SetBrightness_RED_UVATA[2];
	SetBrightness_RED_4_UVATA = gSystemMgr.SetBrightness_RED_UVATA[3];
	SetBrightness_RED_5_UVATA = gSystemMgr.SetBrightness_RED_UVATA[4];

	//SetPos_2_UVATA = gSystemMgr.SetPos_2_UVATA;
	//SetBrightness_2_UVATA = gSystemMgr.SetBrightness_2_UVATA;
	//SetColorTemperature_2_UVATA = gSystemMgr.SetColorTemperature_2_UVATA;
	//SetBrightness_RED_2_UVATA = gSystemMgr.SetBrightness_RED_2_UVATA;
	//
	//SetPos_3_UVATA = gSystemMgr.SetPos_3_UVATA;
	//SetBrightness_3_UVATA = gSystemMgr.SetBrightness_3_UVATA;
	//SetColorTemperature_3_UVATA = gSystemMgr.SetColorTemperature_3_UVATA;
	//SetBrightness_RED_3_UVATA = gSystemMgr.SetBrightness_RED_3_UVATA;
	//
	//SetPos_4_UVATA = gSystemMgr.SetPos_4_UVATA;
	//SetBrightness_4_UVATA = gSystemMgr.SetBrightness_4_UVATA;
	//SetColorTemperature_4_UVATA = gSystemMgr.SetColorTemperature_4_UVATA;
	//SetBrightness_RED_4_UVATA = gSystemMgr.SetBrightness_RED_4_UVATA;
	//
	//SetPos_5_UVATA = gSystemMgr.SetPos_5_UVATA;
	//SetBrightness_5_UVATA = gSystemMgr.SetBrightness_5_UVATA;
	//SetColorTemperature_5_UVATA = gSystemMgr.SetColorTemperature_5_UVATA;
	//SetBrightness_RED_5_UVATA = gSystemMgr.SetBrightness_RED_5_UVATA;

	UpdateData(FALSE);
}

void CRS232SetDlg::SaveValueToConfig()
{
	UpdateData(TRUE);

	gSystemMgr.m_nPowerPort = m_nPowerCom;
	gSystemMgr.m_nPowerBaudrate = m_nPowerPort;
	gSystemMgr.m_nPowerFlag = m_nLinkFlag;
	gSystemMgr.current_limit[0] = m_fCurrentSet0;
	gSystemMgr.voltage_val[0] = m_fValSet0;
	gSystemMgr.current_limit[1] = m_fCurrentSet1;
	gSystemMgr.voltage_val[1] = m_fValSet1;

	gSystemMgr.WhiteLightFlag_UVATA = WhiteLightFlag_UVATA;
	gSystemMgr.RedLightFlag_UVATA = RedLightFlag_UVATA;
	gSystemMgr.RedLightMode_UVATA = m_comboRedLightMode.GetCurSel();

	gSystemMgr.AutoSetLightFlag = AutoSetLightFlag;

	gSystemMgr.SetPos_UVATA[0] = SetPos_UVATA;
	gSystemMgr.SetPos_UVATA[1] = SetPos_2_UVATA;
	gSystemMgr.SetPos_UVATA[2] = SetPos_3_UVATA;
	gSystemMgr.SetPos_UVATA[3] = SetPos_4_UVATA;
	gSystemMgr.SetPos_UVATA[4] = SetPos_5_UVATA;
	gSystemMgr.SetBrightness_UVATA[0] = SetBrightness_UVATA;
	gSystemMgr.SetBrightness_UVATA[1] = SetBrightness_2_UVATA;
	gSystemMgr.SetBrightness_UVATA[2] = SetBrightness_3_UVATA;
	gSystemMgr.SetBrightness_UVATA[3] = SetBrightness_4_UVATA;
	gSystemMgr.SetBrightness_UVATA[4] = SetBrightness_5_UVATA;
	gSystemMgr.SetColorTemperature_UVATA[0] = SetColorTemperature_UVATA;
	gSystemMgr.SetColorTemperature_UVATA[1] = SetColorTemperature_2_UVATA;
	gSystemMgr.SetColorTemperature_UVATA[2] = SetColorTemperature_3_UVATA;
	gSystemMgr.SetColorTemperature_UVATA[3] = SetColorTemperature_4_UVATA;
	gSystemMgr.SetColorTemperature_UVATA[4] = SetColorTemperature_5_UVATA;
	gSystemMgr.SetBrightness_RED_UVATA[0] = SetBrightness_RED_UVATA;
	gSystemMgr.SetBrightness_RED_UVATA[1] = SetBrightness_RED_2_UVATA;
	gSystemMgr.SetBrightness_RED_UVATA[2] = SetBrightness_RED_3_UVATA;
	gSystemMgr.SetBrightness_RED_UVATA[3] = SetBrightness_RED_4_UVATA;
	gSystemMgr.SetBrightness_RED_UVATA[4] = SetBrightness_RED_5_UVATA;

	//gSystemMgr.SetPos_2_UVATA = SetPos_2_UVATA;
	//gSystemMgr.SetBrightness_2_UVATA = SetBrightness_2_UVATA;
	//gSystemMgr.SetColorTemperature_2_UVATA = SetColorTemperature_2_UVATA;
	//gSystemMgr.SetBrightness_RED_2_UVATA = SetBrightness_RED_2_UVATA;
	//
	//gSystemMgr.SetPos_3_UVATA = SetPos_3_UVATA;
	//gSystemMgr.SetBrightness_3_UVATA = SetBrightness_3_UVATA;
	//gSystemMgr.SetColorTemperature_3_UVATA = SetColorTemperature_3_UVATA;
	//gSystemMgr.SetBrightness_RED_3_UVATA = SetBrightness_RED_3_UVATA;
	//
	//gSystemMgr.SetPos_4_UVATA = SetPos_4_UVATA;
	//gSystemMgr.SetBrightness_4_UVATA = SetBrightness_4_UVATA;
	//gSystemMgr.SetColorTemperature_4_UVATA = SetColorTemperature_4_UVATA;
	//gSystemMgr.SetBrightness_RED_4_UVATA = SetBrightness_RED_4_UVATA;
	//
	//gSystemMgr.SetPos_5_UVATA = SetPos_5_UVATA;
	//gSystemMgr.SetBrightness_5_UVATA = SetBrightness_5_UVATA;
	//gSystemMgr.SetColorTemperature_5_UVATA = SetColorTemperature_5_UVATA;
	//gSystemMgr.SetBrightness_RED_5_UVATA = SetBrightness_RED_5_UVATA;


	CString cstr;
	cstr.Format(L"%d", gSystemMgr.AutoSetLightFlag);	gSystemMgr.m_cRS232ConfigIni.SaveConfigIni(L"RS232", L"AutoSetLightFlag", cstr);

	cstr.Format(L"%f", gSystemMgr.SetPos_UVATA[0]);	gSystemMgr.m_cRS232ConfigIni.SaveConfigIni(L"RS232", L"SetPos_UVATA", cstr);
	cstr.Format(L"%f", gSystemMgr.SetPos_UVATA[1]);	gSystemMgr.m_cRS232ConfigIni.SaveConfigIni(L"RS232", L"SetPos_2_UVATA", cstr);
	cstr.Format(L"%f", gSystemMgr.SetPos_UVATA[2]);	gSystemMgr.m_cRS232ConfigIni.SaveConfigIni(L"RS232", L"SetPos_3_UVATA", cstr);
	cstr.Format(L"%f", gSystemMgr.SetPos_UVATA[3]);	gSystemMgr.m_cRS232ConfigIni.SaveConfigIni(L"RS232", L"SetPos_4_UVATA", cstr);
	cstr.Format(L"%f", gSystemMgr.SetPos_UVATA[4]);	gSystemMgr.m_cRS232ConfigIni.SaveConfigIni(L"RS232", L"SetPos_5_UVATA", cstr);
	cstr.Format(L"%d", gSystemMgr.SetBrightness_UVATA[0]);	gSystemMgr.m_cRS232ConfigIni.SaveConfigIni(L"RS232", L"SetBrightness_UVATA", cstr);
	cstr.Format(L"%d", gSystemMgr.SetBrightness_UVATA[1]);	gSystemMgr.m_cRS232ConfigIni.SaveConfigIni(L"RS232", L"SetBrightness_2_UVATA", cstr);
	cstr.Format(L"%d", gSystemMgr.SetBrightness_UVATA[2]);	gSystemMgr.m_cRS232ConfigIni.SaveConfigIni(L"RS232", L"SetBrightness_3_UVATA", cstr);
	cstr.Format(L"%d", gSystemMgr.SetBrightness_UVATA[3]);	gSystemMgr.m_cRS232ConfigIni.SaveConfigIni(L"RS232", L"SetBrightness_4_UVATA", cstr);
	cstr.Format(L"%d", gSystemMgr.SetBrightness_UVATA[4]);	gSystemMgr.m_cRS232ConfigIni.SaveConfigIni(L"RS232", L"SetBrightness_5_UVATA", cstr);
	cstr.Format(L"%d", gSystemMgr.SetColorTemperature_UVATA[0]);	gSystemMgr.m_cRS232ConfigIni.SaveConfigIni(L"RS232", L"SetColorTemperature_UVATA", cstr);
	cstr.Format(L"%d", gSystemMgr.SetColorTemperature_UVATA[1]);	gSystemMgr.m_cRS232ConfigIni.SaveConfigIni(L"RS232", L"SetColorTemperature_2_UVATA", cstr);
	cstr.Format(L"%d", gSystemMgr.SetColorTemperature_UVATA[2]);	gSystemMgr.m_cRS232ConfigIni.SaveConfigIni(L"RS232", L"SetColorTemperature_3_UVATA", cstr);
	cstr.Format(L"%d", gSystemMgr.SetColorTemperature_UVATA[3]);	gSystemMgr.m_cRS232ConfigIni.SaveConfigIni(L"RS232", L"SetColorTemperature_4_UVATA", cstr);
	cstr.Format(L"%d", gSystemMgr.SetColorTemperature_UVATA[4]);	gSystemMgr.m_cRS232ConfigIni.SaveConfigIni(L"RS232", L"SetColorTemperature_5_UVATA", cstr);
	cstr.Format(L"%d", gSystemMgr.SetBrightness_RED_UVATA[0]); gSystemMgr.m_cRS232ConfigIni.SaveConfigIni(L"RS232", L"SetBrightness_RED_UVATA", cstr);
	cstr.Format(L"%d", gSystemMgr.SetBrightness_RED_UVATA[1]); gSystemMgr.m_cRS232ConfigIni.SaveConfigIni(L"RS232", L"SetBrightness_RED_2_UVATA", cstr);
	cstr.Format(L"%d", gSystemMgr.SetBrightness_RED_UVATA[2]); gSystemMgr.m_cRS232ConfigIni.SaveConfigIni(L"RS232", L"SetBrightness_RED_3_UVATA", cstr);
	cstr.Format(L"%d", gSystemMgr.SetBrightness_RED_UVATA[3]); gSystemMgr.m_cRS232ConfigIni.SaveConfigIni(L"RS232", L"SetBrightness_RED_4_UVATA", cstr);
	cstr.Format(L"%d", gSystemMgr.SetBrightness_RED_UVATA[4]); gSystemMgr.m_cRS232ConfigIni.SaveConfigIni(L"RS232", L"SetBrightness_RED_5_UVATA", cstr);

	//cstr.Format(L"%f", gSystemMgr.SetPos_2_UVATA);	gSystemMgr.m_cRS232ConfigIni.SaveConfigIni(L"RS232", L"SetPos_2_UVATA", cstr);
	//cstr.Format(L"%f", gSystemMgr.SetPos_3_UVATA);	gSystemMgr.m_cRS232ConfigIni.SaveConfigIni(L"RS232", L"SetPos_3_UVATA", cstr);
	//cstr.Format(L"%f", gSystemMgr.SetPos_4_UVATA);	gSystemMgr.m_cRS232ConfigIni.SaveConfigIni(L"RS232", L"SetPos_4_UVATA", cstr);
	//cstr.Format(L"%f", gSystemMgr.SetPos_5_UVATA);	gSystemMgr.m_cRS232ConfigIni.SaveConfigIni(L"RS232", L"SetPos_5_UVATA", cstr);
	//cstr.Format(L"%d", gSystemMgr.SetBrightness_2_UVATA);	gSystemMgr.m_cRS232ConfigIni.SaveConfigIni(L"RS232", L"SetBrightness_2_UVATA", cstr);
	//cstr.Format(L"%d", gSystemMgr.SetBrightness_3_UVATA);	gSystemMgr.m_cRS232ConfigIni.SaveConfigIni(L"RS232", L"SetBrightness_3_UVATA", cstr);
	//cstr.Format(L"%d", gSystemMgr.SetBrightness_4_UVATA);	gSystemMgr.m_cRS232ConfigIni.SaveConfigIni(L"RS232", L"SetBrightness_4_UVATA", cstr);
	//cstr.Format(L"%d", gSystemMgr.SetBrightness_5_UVATA);	gSystemMgr.m_cRS232ConfigIni.SaveConfigIni(L"RS232", L"SetBrightness_5_UVATA", cstr);
	//cstr.Format(L"%d", gSystemMgr.SetColorTemperature_2_UVATA);	gSystemMgr.m_cRS232ConfigIni.SaveConfigIni(L"RS232", L"SetColorTemperature_2_UVATA", cstr);
	//cstr.Format(L"%d", gSystemMgr.SetColorTemperature_3_UVATA);	gSystemMgr.m_cRS232ConfigIni.SaveConfigIni(L"RS232", L"SetColorTemperature_3_UVATA", cstr);
	//cstr.Format(L"%d", gSystemMgr.SetColorTemperature_4_UVATA);	gSystemMgr.m_cRS232ConfigIni.SaveConfigIni(L"RS232", L"SetColorTemperature_4_UVATA", cstr);
	//cstr.Format(L"%d", gSystemMgr.SetColorTemperature_5_UVATA);	gSystemMgr.m_cRS232ConfigIni.SaveConfigIni(L"RS232", L"SetColorTemperature_5_UVATA", cstr);
	//cstr.Format(L"%d", gSystemMgr.SetBrightness_RED_2_UVATA); gSystemMgr.m_cRS232ConfigIni.SaveConfigIni(L"RS232", L"SetBrightness_RED_2_UVATA", cstr);
	//cstr.Format(L"%d", gSystemMgr.SetBrightness_RED_3_UVATA); gSystemMgr.m_cRS232ConfigIni.SaveConfigIni(L"RS232", L"SetBrightness_RED_3_UVATA", cstr);
	//cstr.Format(L"%d", gSystemMgr.SetBrightness_RED_4_UVATA); gSystemMgr.m_cRS232ConfigIni.SaveConfigIni(L"RS232", L"SetBrightness_RED_4_UVATA", cstr);
	//cstr.Format(L"%d", gSystemMgr.SetBrightness_RED_5_UVATA); gSystemMgr.m_cRS232ConfigIni.SaveConfigIni(L"RS232", L"SetBrightness_RED_5_UVATA", cstr);

	cstr.Format(L"%d", gSystemMgr.WhiteLightFlag_UVATA);
	gSystemMgr.m_cRS232ConfigIni.SaveConfigIni(L"RS232", L"WhiteLightFlag_UVATA", cstr);
	cstr.Format(L"%d", gSystemMgr.RedLightFlag_UVATA);
	gSystemMgr.m_cRS232ConfigIni.SaveConfigIni(L"RS232", L"RedLightFlag_UVATA", cstr);
	cstr.Format(L"%d", gSystemMgr.RedLightMode_UVATA);
	gSystemMgr.m_cRS232ConfigIni.SaveConfigIni(L"RS232", L"RedLightMode_UVATA", cstr);

	cstr.Format(L"%d", gSystemMgr.m_nPowerPort);
	gSystemMgr.m_cRS232ConfigIni.SaveConfigIni(L"Power", L"m_nPowerPort", cstr);

	cstr.Format(L"%d", gSystemMgr.m_nPowerBaudrate);
	gSystemMgr.m_cRS232ConfigIni.SaveConfigIni(L"Power", L"m_nPowerBaudrate", cstr);

	cstr.Format(L"%d", gSystemMgr.m_nPowerFlag);
	gSystemMgr.m_cRS232ConfigIni.SaveConfigIni(L"Power", L"m_nPowerFlag", cstr);

	cstr.Format(L"%.2f", gSystemMgr.current_limit[0]);
	gSystemMgr.m_cRS232ConfigIni.SaveConfigIni(L"Power", L"current_limit[0]", cstr);

	cstr.Format(L"%.2f", gSystemMgr.current_limit[1]);
	gSystemMgr.m_cRS232ConfigIni.SaveConfigIni(L"Power", L"current_limit[1]", cstr);

	cstr.Format(L"%.2f", gSystemMgr.voltage_val[0]);
	gSystemMgr.m_cRS232ConfigIni.SaveConfigIni(L"Power", L"voltage_val[0]", cstr);

	cstr.Format(L"%.2f", gSystemMgr.voltage_val[1]);
	gSystemMgr.m_cRS232ConfigIni.SaveConfigIni(L"Power", L"voltage_val[1]", cstr);

	gSystemLog.DisplayLogAndSave(L"RS232保存数据完成", LV_EVENT);
}

void CRS232SetDlg::OnBnClickedButtonSave()
{
	SaveValueToConfig();
}


void CRS232SetDlg::OnBnClickedButton2()
{
	gSystemMgr.Connect_UVATA();
}


void CRS232SetDlg::OnBnClickedButton4()
{
	gSystemMgr.GetPos_UVATA();
}


void CRS232SetDlg::OnBnClickedButton5()
{
	gSystemMgr.DisConnect_UVATA();
}


void CRS232SetDlg::OnBnClickedButton10()
{
	gSystemMgr.MovePos_UVATA();
}


void CRS232SetDlg::OnBnClickedButton3()
{
	gSystemMgr.SetLight_UVATA();
}


void CRS232SetDlg::OnBnClickedButton6()
{
	gSystemMgr.SetLight_UVATA2();
}


void CRS232SetDlg::OnBnClickedButton23()
{
	gSystemMgr.CloseLight_UVATA();
}
